package com.base.cn.platform.os.service.manage.user.member;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.Map;

/**
 *  会员记录规则接口
 *
 * @author ll
 * @create 2018-04-25
 */
@FeignClient(value = BaseService.appName,configuration = FeignAuthConfig.class)
public interface CusUserMemberBuyRecordService extends BaseService {

    /**
     * 修改会员开通记录状态
     * @param id 开通记录ID
     * @param status 状态，1正常，2禁用
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/user/updateUserMemberBuyRecordStatus")
    Map<String,Object> updateUserMemberBuyRecordStatus(@RequestParam("id") BigDecimal id,
                                                       @RequestParam("status") Integer status);

    /**
     * 检测用户是否有会员权限
     * @param userId 用户ID
     * @return true有，false 没有
     */
    @RequestMapping(contextPath + "/user/checkUserUseMemberPrice")
    boolean checkUserUseMemberPrice(@RequestParam("userId") BigDecimal userId);

    /**
     * 添加会员购买与你
     * @param userId 用户ID
     * @param day 购买会员天数
     */
    @RequestMapping(contextPath + "/user/addUserMemberBuyRecord")
    void addUserMemberBuyRecord(@RequestParam("userId") BigDecimal userId, @RequestParam("day") int day);

    /**
     * 修改会员有效时间 (用于退费)
     * @param userId 用户ID
     * @param day 更新天数（正数是加，负数是减）
     */
    @RequestMapping(contextPath + "/user/updateMemberBuyRecordValidTime")
    void updateMemberBuyRecordValidTime(@RequestParam("userId") BigDecimal userId, @RequestParam("day") int day);

    /**
     * 获取用户开通的会员记录
     * @param userId 用户ID
     * @return UserMemberBuyRecord
     */
    @RequestMapping(contextPath + "/user/queryUserBuyMemberRecord")
    Map<String,Object> queryUserBuyMemberRecord(@RequestParam("userId") BigDecimal userId);


    /**
     * 搜索分页用户会员记录
     * @param userMemberBuyRecord
     * @param currentPage
     * @return
     */
    @RequestMapping(contextPath + "/user/queryUserMemberBuyRecordListPage")
    Map<String,Object> queryUserMemberBuyRecordListPage(
            @RequestBody Map<String, Object> userMemberBuyRecord,
            @RequestParam("currentPage") Integer currentPage);
}
